package TEST;

public class Rectangle {
    private int length;
    private int width;

    Rectangle(int length,int width){
        this.length=length;
        this.width=width;
    }

    public void showAll(){
        System.out.println("矩形长为:"+length+"\t"+"矩形的宽为:"+width+"\t"+"矩形的面积为:"+getArea()+"\t"+"矩形的周长为:"+getPer());
    }

    public int getPer(){
        return 2*(length+width);
    }

    public int getArea(){
        return length*width;
    }
}
class RectangleDemo{
    public static void main(String[] args){
        Rectangle r=new Rectangle(2,3);
        r.showAll();
    }
}
